# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[return log_none(*args)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e7b0c>}
nname: 0
n 0(None)[]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e7a4c>}
nname: 0
n 0(None)[return log.info(*args)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e71ac>}
nname: 0
n 0(None)[return log.info(*args)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e70ec>}
nname: 0
n 0(None)[return log.info(*args)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e704c>}
nname: 0
n 0(None)[wyvas.Container.__init__(self)
self._time_bar_name = None
self._time_reference = 0
self._time_period = 3600
self._Timebar__duration = 0
self._Timebar__begin = 0
self._Timebar__width = int_to_percent(0)
self._Timebar__left = int_to_percent(0)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ede4c>}
nname: 0
n 0(None)[self._time_reference = reference
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ed6cc>}
nname: 0
n 0(None)[self._time_bar_name = bar
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ed70c>}
nname: 0
n 0(None)[self._time_period = period
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ed6ac>}
nname: 0
n 0(None)[return self._Timebar__duration
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ed64c>}
nname: 0
n 0(None)[self._Timebar__duration = duration
self._Timebar__width = int_to_percent(int(self._Timebar__duration * 100.0 / self._time_period + 0.5))
log_val('=============> time_bar class : set_duration (width) = %s' % self._Timebar__width)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75edd6c>}
nname: 0
n 0(None)[return self._Timebar__begin
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ed70c>}
nname: 126
n 126(None)[self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5))
log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)
]:
	i: 96(), 125()
	o: 

nname: 125
n 125(None)[]:
	i: 0(f)
	o: 126()

nname: 96
n 96(None)[self._Timebar__width = int_to_percent(int(50 - intleft))
]:
	i: 0(t)
	o: 126()

nname: 0
n 0(intleft + intwidth < 50)[self._Timebar__begin = time
intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)
intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5)
]:
	i: 
	o: 96(t), 125(f)

nname: 0
n 0(None)[self._Timebar__begin = time
intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)
intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5)
if intleft + intwidth < 50:
	self._Timebar__width = int_to_percent(int(50 - intleft))
self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5))
log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f032c>}
nname: 212
n 212(None)[self._redraw()
]:
	i: 171(), 211()
	o: 

nname: 211
n 211(None)[]:
	i: 159(f)
	o: 212()

nname: 171
n 171(None)[self._begin = kwargs['begin']
log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
]:
	i: 159(t)
	o: 212()

nname: 159
n 159('begin' in kwargs)[]:
	i: 118(), 158()
	o: 171(t), 211(f)

nname: 158
n 158(None)[]:
	i: 106(f)
	o: 159()

nname: 118
n 118(None)[self._duration = kwargs['duration']
log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
]:
	i: 106(t)
	o: 159()

nname: 106
n 106('duration' in kwargs)[]:
	i: 65(), 105()
	o: 118(t), 158(f)

nname: 105
n 105(None)[]:
	i: 53(f)
	o: 106()

nname: 65
n 65(None)[self._time_period = kwargs['period']
log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
]:
	i: 53(t)
	o: 106()

nname: 53
n 53('period' in kwargs)[]:
	i: 12(), 52()
	o: 65(t), 105(f)

nname: 52
n 52(None)[]:
	i: 0(f)
	o: 53()

nname: 12
n 12(None)[self._time_reference = kwargs['reference']
log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
]:
	i: 0(t)
	o: 53()

nname: 0
n 0('reference' in kwargs)[]:
	i: 
	o: 12(t), 52(f)

nname: 212
n 212(None)[self._redraw()
]:
	i: 106()
	o: 

nname: 106
n 106(None)[if 'duration' in kwargs:
	self._duration = kwargs['duration']
	log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
if 'begin' in kwargs:
	self._begin = kwargs['begin']
	log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
]:
	i: 0()
	o: 212()

nname: 0
n 0(None)[if 'reference' in kwargs:
	self._time_reference = kwargs['reference']
	log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
if 'period' in kwargs:
	self._time_period = kwargs['period']
	log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
]:
	i: 
	o: 106()

nname: 212
n 212(None)[self._redraw()
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if 'reference' in kwargs:
	self._time_reference = kwargs['reference']
	log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
if 'period' in kwargs:
	self._time_period = kwargs['period']
	log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
if 'duration' in kwargs:
	self._duration = kwargs['duration']
	log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
if 'begin' in kwargs:
	self._begin = kwargs['begin']
	log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
]:
	i: 
	o: 212()

nname: 0
n 0(None)[if 'reference' in kwargs:
	self._time_reference = kwargs['reference']
	log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
if 'period' in kwargs:
	self._time_period = kwargs['period']
	log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
if 'duration' in kwargs:
	self._duration = kwargs['duration']
	log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
if 'begin' in kwargs:
	self._begin = kwargs['begin']
	log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
self._redraw()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75f050c>}
nname: 73
n 73(None)[]:
	i: 0(AL), 72()
	o: 

nname: 72
n 72(None)[]:
	i: 21(AF), 28()
	o: 73()

nname: 28
n 28(None)[for bar in bar_list:
bar.resize(width=self._Timebar__width)
bar.move(left=self._Timebar__left)
]:
	i: 21(for)
	o: 72()

nname: 21
n 21(None)[]:
	i: 0(loop)
	o: 28(for), 72(AF)

nname: 0
n 0(None)[bar_list = self.get_list_obj_by_name(self._time_bar_name)
]:
	i: 
	o: 21(loop), 73(AL)

nname: 73
n 73(None)[]:
	i: 28()
	o: 

nname: 28
n 28(None)[for bar in bar_list:
	bar.resize(width=self._Timebar__width)
	bar.move(left=self._Timebar__left)
]:
	i: 0(for)
	o: 73()

nname: 0
n 0(None)[bar_list = self.get_list_obj_by_name(self._time_bar_name)
]:
	i: 
	o: 28(for)

nname: 73
n 73(None)[]:
	i: 0()
	o: 

nname: 0
n 0(None)[bar_list = self.get_list_obj_by_name(self._time_bar_name)
for bar in bar_list:
	bar.resize(width=self._Timebar__width)
	bar.move(left=self._Timebar__left)
]:
	i: 
	o: 73()

nname: 0
n 0(None)[bar_list = self.get_list_obj_by_name(self._time_bar_name)
for bar in bar_list:
	bar.resize(width=self._Timebar__width)
	bar.move(left=self._Timebar__left)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75edb2c>}
nname: 6
n 6(None)[def __init__(self):
	wyvas.Container.__init__(self)
	self._time_bar_name = None
	self._time_reference = 0
	self._time_period = 3600
	self._Timebar__duration = 0
	self._Timebar__begin = 0
	self._Timebar__width = int_to_percent(0)
	self._Timebar__left = int_to_percent(0)
	return None

def set_reference(self, reference=0):
	self._time_reference = reference

def set_bar(self, bar=''):
	self._time_bar_name = bar

def set_period(self, period=3600):
	self._time_period = period

def _get_duration(self):
	return self._Timebar__duration

def set_duration(self, duration=0):
	self._Timebar__duration = duration
	self._Timebar__width = int_to_percent(int(self._Timebar__duration * 100.0 / self._time_period + 0.5))
	log_val('=============> time_bar class : set_duration (width) = %s' % self._Timebar__width)

_duration = property(_get_duration, set_duration)
def _get_begin(self):
	return self._Timebar__begin

def set_begin(self, time):
	self._Timebar__begin = time
	intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)
	intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5)
	if intleft + intwidth < 50:
		self._Timebar__width = int_to_percent(int(50 - intleft))
	self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5))
	log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)

_begin = property(_get_begin, set_begin)
def set(self, **kwargs):
	if 'reference' in kwargs:
		self._time_reference = kwargs['reference']
		log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
	if 'period' in kwargs:
		self._time_period = kwargs['period']
		log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
	if 'duration' in kwargs:
		self._duration = kwargs['duration']
		log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
	if 'begin' in kwargs:
		self._begin = kwargs['begin']
		log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
	self._redraw()

def _redraw(self):
	bar_list = self.get_list_obj_by_name(self._time_bar_name)
	for bar in bar_list:
		bar.resize(width=self._Timebar__width)
		bar.move(left=self._Timebar__left)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75e7dac>}
nname: 220
n 220(None)[class Timebar(.):
	def __init__(self):
		wyvas.Container.__init__(self)
		self._time_bar_name = None
		self._time_reference = 0
		self._time_period = 3600
		self._Timebar__duration = 0
		self._Timebar__begin = 0
		self._Timebar__width = int_to_percent(0)
		self._Timebar__left = int_to_percent(0)
		return None

	def set_reference(self, reference=0):
		self._time_reference = reference

	def set_bar(self, bar=''):
		self._time_bar_name = bar

	def set_period(self, period=3600):
		self._time_period = period

	def _get_duration(self):
		return self._Timebar__duration

	def set_duration(self, duration=0):
		self._Timebar__duration = duration
		self._Timebar__width = int_to_percent(int(self._Timebar__duration * 100.0 / self._time_period + 0.5))
		log_val('=============> time_bar class : set_duration (width) = %s' % self._Timebar__width)

	_duration = property(_get_duration, set_duration)
	def _get_begin(self):
		return self._Timebar__begin

	def set_begin(self, time):
		self._Timebar__begin = time
		intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)
		intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5)
		if intleft + intwidth < 50:
			self._Timebar__width = int_to_percent(int(50 - intleft))
		self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5))
		log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)

	_begin = property(_get_begin, set_begin)
	def set(self, **kwargs):
		if 'reference' in kwargs:
			self._time_reference = kwargs['reference']
			log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
		if 'period' in kwargs:
			self._time_period = kwargs['period']
			log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
		if 'duration' in kwargs:
			self._duration = kwargs['duration']
			log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
		if 'begin' in kwargs:
			self._begin = kwargs['begin']
			log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
		self._redraw()

	def _redraw(self):
		bar_list = self.get_list_obj_by_name(self._time_bar_name)
		for bar in bar_list:
			bar.resize(width=self._Timebar__width)
			bar.move(left=self._Timebar__left)



]:
	i: 200(), 210()
	o: 

nname: 210
n 210(None)[def log_info(*args):
	return log.info(*args)

]:
	i: 194(t)
	o: 220()

nname: 200
n 200(None)[log_info = nolog
]:
	i: 194(f)
	o: 220()

nname: 194
n 194(LOG_INFO)[]:
	i: 174(), 184()
	o: 200(f), 210(t)

nname: 184
n 184(None)[def log_val(*args):
	return log.info(*args)

]:
	i: 168(t)
	o: 194()

nname: 174
n 174(None)[log_val = nolog
]:
	i: 168(f)
	o: 194()

nname: 168
n 168(LOG_VAL)[]:
	i: 148(), 158()
	o: 174(f), 184(t)

nname: 158
n 158(None)[def log_func(*args):
	return log.info(*args)

]:
	i: 0(t)
	o: 168()

nname: 148
n 148(None)[log_func = nolog
]:
	i: 0(f)
	o: 168()

nname: 0
n 0(LOG_FUNC)[from __future__ import absolute_import
import wyvas
from math import ceil
from peewee.debug import DEBUG, GET_LOGGER
from peewee.formatters import seconds_to_hhmm, seconds_to_hhmmss, int_to_percent
log = GET_LOGGER(__name__)
LOG_VAL = False
LOG_INFO = False
LOG_FUNC = False
def nolog(*args):
	return log_none(*args)

def log_none(*args):
	pass

]:
	i: 
	o: 148(f), 158(t)

nname: 194
n 194(None)[if not LOG_INFO:
	log_info = nolog
else:
	def log_info(*args):
		return log.info(*args)

class Timebar(.):
	def __init__(self):
		wyvas.Container.__init__(self)
		self._time_bar_name = None
		self._time_reference = 0
		self._time_period = 3600
		self._Timebar__duration = 0
		self._Timebar__begin = 0
		self._Timebar__width = int_to_percent(0)
		self._Timebar__left = int_to_percent(0)
		return None

	def set_reference(self, reference=0):
		self._time_reference = reference

	def set_bar(self, bar=''):
		self._time_bar_name = bar

	def set_period(self, period=3600):
		self._time_period = period

	def _get_duration(self):
		return self._Timebar__duration

	def set_duration(self, duration=0):
		self._Timebar__duration = duration
		self._Timebar__width = int_to_percent(int(self._Timebar__duration * 100.0 / self._time_period + 0.5))
		log_val('=============> time_bar class : set_duration (width) = %s' % self._Timebar__width)

	_duration = property(_get_duration, set_duration)
	def _get_begin(self):
		return self._Timebar__begin

	def set_begin(self, time):
		self._Timebar__begin = time
		intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)
		intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5)
		if intleft + intwidth < 50:
			self._Timebar__width = int_to_percent(int(50 - intleft))
		self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5))
		log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)

	_begin = property(_get_begin, set_begin)
	def set(self, **kwargs):
		if 'reference' in kwargs:
			self._time_reference = kwargs['reference']
			log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
		if 'period' in kwargs:
			self._time_period = kwargs['period']
			log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
		if 'duration' in kwargs:
			self._duration = kwargs['duration']
			log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
		if 'begin' in kwargs:
			self._begin = kwargs['begin']
			log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
		self._redraw()

	def _redraw(self):
		bar_list = self.get_list_obj_by_name(self._time_bar_name)
		for bar in bar_list:
			bar.resize(width=self._Timebar__width)
			bar.move(left=self._Timebar__left)



]:
	i: 0()
	o: 

nname: 0
n 0(None)[from __future__ import absolute_import
import wyvas
from math import ceil
from peewee.debug import DEBUG, GET_LOGGER
from peewee.formatters import seconds_to_hhmm, seconds_to_hhmmss, int_to_percent
log = GET_LOGGER(__name__)
LOG_VAL = False
LOG_INFO = False
LOG_FUNC = False
def nolog(*args):
	return log_none(*args)

def log_none(*args):
	pass

if not LOG_FUNC:
	log_func = nolog
else:
	def log_func(*args):
		return log.info(*args)

if not LOG_VAL:
	log_val = nolog
else:
	def log_val(*args):
		return log.info(*args)

]:
	i: 
	o: 194()

nname: 0
n 0(None)[from __future__ import absolute_import
import wyvas
from math import ceil
from peewee.debug import DEBUG, GET_LOGGER
from peewee.formatters import seconds_to_hhmm, seconds_to_hhmmss, int_to_percent
log = GET_LOGGER(__name__)
LOG_VAL = False
LOG_INFO = False
LOG_FUNC = False
def nolog(*args):
	return log_none(*args)

def log_none(*args):
	pass

if not LOG_FUNC:
	log_func = nolog
else:
	def log_func(*args):
		return log.info(*args)

if not LOG_VAL:
	log_val = nolog
else:
	def log_val(*args):
		return log.info(*args)

if not LOG_INFO:
	log_info = nolog
else:
	def log_info(*args):
		return log.info(*args)

class Timebar(.):
	def __init__(self):
		wyvas.Container.__init__(self)
		self._time_bar_name = None
		self._time_reference = 0
		self._time_period = 3600
		self._Timebar__duration = 0
		self._Timebar__begin = 0
		self._Timebar__width = int_to_percent(0)
		self._Timebar__left = int_to_percent(0)
		return None

	def set_reference(self, reference=0):
		self._time_reference = reference

	def set_bar(self, bar=''):
		self._time_bar_name = bar

	def set_period(self, period=3600):
		self._time_period = period

	def _get_duration(self):
		return self._Timebar__duration

	def set_duration(self, duration=0):
		self._Timebar__duration = duration
		self._Timebar__width = int_to_percent(int(self._Timebar__duration * 100.0 / self._time_period + 0.5))
		log_val('=============> time_bar class : set_duration (width) = %s' % self._Timebar__width)

	_duration = property(_get_duration, set_duration)
	def _get_begin(self):
		return self._Timebar__begin

	def set_begin(self, time):
		self._Timebar__begin = time
		intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)
		intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5)
		if intleft + intwidth < 50:
			self._Timebar__width = int_to_percent(int(50 - intleft))
		self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5))
		log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)

	_begin = property(_get_begin, set_begin)
	def set(self, **kwargs):
		if 'reference' in kwargs:
			self._time_reference = kwargs['reference']
			log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
		if 'period' in kwargs:
			self._time_period = kwargs['period']
			log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
		if 'duration' in kwargs:
			self._duration = kwargs['duration']
			log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
		if 'begin' in kwargs:
			self._begin = kwargs['begin']
			log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
		self._redraw()

	def _redraw(self):
		bar_list = self.get_list_obj_by_name(self._time_bar_name)
		for bar in bar_list:
			bar.resize(width=self._Timebar__width)
			bar.move(left=self._Timebar__left)



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e7cac>}
from __future__ import absolute_import
import wyvas
from math import ceil
from peewee.debug import DEBUG, GET_LOGGER
from peewee.formatters import seconds_to_hhmm, seconds_to_hhmmss, int_to_percent
log = GET_LOGGER(__name__)
LOG_VAL = False
LOG_INFO = False
LOG_FUNC = False
def nolog(*args):
	return log_none(*args)

def log_none(*args):
	pass

if not LOG_FUNC:
	log_func = nolog
else:
	def log_func(*args):
		return log.info(*args)

if not LOG_VAL:
	log_val = nolog
else:
	def log_val(*args):
		return log.info(*args)

if not LOG_INFO:
	log_info = nolog
else:
	def log_info(*args):
		return log.info(*args)

class Timebar(.):
	def __init__(self):
		wyvas.Container.__init__(self)
		self._time_bar_name = None
		self._time_reference = 0
		self._time_period = 3600
		self._Timebar__duration = 0
		self._Timebar__begin = 0
		self._Timebar__width = int_to_percent(0)
		self._Timebar__left = int_to_percent(0)
		return None

	def set_reference(self, reference=0):
		self._time_reference = reference

	def set_bar(self, bar=''):
		self._time_bar_name = bar

	def set_period(self, period=3600):
		self._time_period = period

	def _get_duration(self):
		return self._Timebar__duration

	def set_duration(self, duration=0):
		self._Timebar__duration = duration
		self._Timebar__width = int_to_percent(int(self._Timebar__duration * 100.0 / self._time_period + 0.5))
		log_val('=============> time_bar class : set_duration (width) = %s' % self._Timebar__width)

	_duration = property(_get_duration, set_duration)
	def _get_begin(self):
		return self._Timebar__begin

	def set_begin(self, time):
		self._Timebar__begin = time
		intleft = int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5)
		intwidth = int(self._Timebar__duration * 100.0 / self._time_period + 0.5)
		if intleft + intwidth < 50:
			self._Timebar__width = int_to_percent(int(50 - intleft))
		self._Timebar__left = int_to_percent(int((self._Timebar__begin - self._time_reference) * 100.0 / self._time_period + 50 + 0.5))
		log_val('=============> time_bar class : set_begin (left) = %s' % self._Timebar__left)

	_begin = property(_get_begin, set_begin)
	def set(self, **kwargs):
		if 'reference' in kwargs:
			self._time_reference = kwargs['reference']
			log_val('=============> time_bar class : reference = %s' % seconds_to_hhmm(self._time_reference))
		if 'period' in kwargs:
			self._time_period = kwargs['period']
			log_val('=============> time_bar class : _time_period = %s' % seconds_to_hhmmss(self._time_period))
		if 'duration' in kwargs:
			self._duration = kwargs['duration']
			log_val('=============> time_bar class : _duration = %s' % seconds_to_hhmmss(self._duration))
		if 'begin' in kwargs:
			self._begin = kwargs['begin']
			log_val('=============> time_bar class : _begin = %s' % seconds_to_hhmm(self._begin))
		self._redraw()

	def _redraw(self):
		bar_list = self.get_list_obj_by_name(self._time_bar_name)
		for bar in bar_list:
			bar.resize(width=self._Timebar__width)
			bar.move(left=self._Timebar__left)



